package com.shanxia.codec.enums;

import java.util.Objects;

public enum BatteryVolExceptionEnum {

    NORMMAL(0x00, "正常"),
    EXCPTION(0x01, "电压异常"),
    UNTRUSTED(0x10, "不可信状态"),
    UNKNOWN(99, "未知");

    public static BatteryVolExceptionEnum getByCode(int code) {
        for (BatteryVolExceptionEnum enums : BatteryVolExceptionEnum.values()) {
            if (Objects.equals(enums.code, code)) {
                return enums;
            }
        }
        return BatteryVolExceptionEnum.UNKNOWN;
    }

    BatteryVolExceptionEnum(int code, String name) {
        this.code = code;
        this.name = name;
    }

    public int code;
    public String name;
}